tools/libxc: Don't leave scratch_pfn uninitialised if the domain has no memory
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 28 Jan 2015 15:52:35 +0000 (15:52 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 2 Feb 2015 14:37:06 +0000 (14:37 +0000)
commit5b0447f647b1031595d24a8a50b362726c887d12
treee46dfabe56861d0fa75499b1616e1dfc4b8756fe
parentd8e1ee8182d0dc2d472063aaad41e02507dd2162
tools/libxc: Don't leave scratch_pfn uninitialised if the domain has no memory

c/s 5b5c40c0d1 "libxc: introduce a per architecture scratch pfn for temporary
grant mapping" accidentally an issue whereby there were two paths out of
xc_core_arch_get_scratch_gpfn() which returned 0, but only one of which
assigned a value to the gpfn parameter.

xc_domain_maximum_gpfn() can validly return 0, at which point gpfn 1 is a
valid scratch page to use.

In addition, widen rc before adding 1 and possibly overflowing.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Julien Grall <julien.grall@linaro.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_core_x86.c